package com.qf.controller;
import com.qf.Movie;
import com.qf.ResultVo;
import com.qf.service.MovieService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("movie")
@CrossOrigin
public class MovieController {

    @Autowired
    private MovieService movieService;

    //根据电影id查询电影
    @RequestMapping("movie")
    public ResultVo now(@RequestParam(defaultValue = "1")Integer movieId){
        ResultVo resultVo = movieService.selectMovieById(movieId);
        return resultVo;
    }

    //根据电影id查询演员
    @RequestMapping("actor")
    public ResultVo actor(@RequestParam(defaultValue = "1")Integer movieId){
        ResultVo resultVo = movieService.selectActorById(movieId);
        return resultVo;
    }

    //根据电影id查询电影详情
    @RequestMapping("desc")
    public ResultVo desc(@RequestParam(defaultValue = "1")Integer movieId){
        ResultVo resultVo = movieService.selectDescById(movieId);
        return resultVo;
    }


    //根据电影id查询照片
    @RequestMapping("pic")
    public ResultVo pic(@RequestParam(defaultValue = "1") Integer movieId){
        ResultVo resultVo = movieService.selectMoviePicById(movieId);
        return resultVo;
    }


    //根据电影id查询电影类型
    @RequestMapping("type")
    public ResultVo type(@RequestParam(defaultValue = "1")Integer movieId){
        ResultVo resultVo = movieService.selectTypeById(movieId);
        return resultVo;
    }


    //根据电影id查询用户以及电影评论区
    @RequestMapping("comment")
    public ResultVo comment(@RequestParam(defaultValue = "1")Integer movieId){
        ResultVo resultVo = movieService.selectUserCommentById(movieId);
        return resultVo;
    }



}
